home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / docs / misc / ConcNews.lha / news / general.programming / comp.programming_623_000004.msg < prev    next >
Encoding:
Text File  |  1994-11-27  |  2.0 KB  |  44 lines

  1. Newsgroups: comp.programming
  2. Path: dd.chalmers.se!news.chalmers.se!sunic!EU.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!mnemosyne.cs.du.edu!nyx10!colin
  3. From: colin@nyx10.cs.du.edu (Colin Plumb)
  4. Subject: Re: Best way to manage memory in a text editor
  5. Message-ID: <1993Dec6.222518.14989@mnemosyne.cs.du.edu>
  6. X-Disclaimer: Nyx is a public access Unix system run by the University
  7.      of Denver for the Denver community.  The University has neither
  8.      control over nor responsibility for the opinions of users.
  9. Sender: usenet@mnemosyne.cs.du.edu (netnews admin account)
  10. Organization: Nyx, Public Access Unix at U. of Denver Math/CS dept.
  11. References: <1993Dec5.171902.21420@bilver.oau.org>
  12. Date: Mon, 6 Dec 93 22:25:18 GMT
  13. Lines: 29
  14.  
  15. In article <1993Dec5.171902.21420@bilver.oau.org>,
  16. Alex Matulich <alex@bilver.oau.org> wrote:
  17. >
  18. >Hi.  I'm the author of a timed script player for titling foreign videos.
  19. >My users have been clamoring for a built-in editor to my software, so I
  20. >began writing a simple text editor to do the job.
  21. >
  22. >I soon discovered that I had several memory management options open to me,
  23. >and I was uncertain which was best.  Certainly some were more difficult to
  24. >implement than others. 
  25.  
  26. Get a book titled _The Craft of Text Editing: Emacs for the modern world_.
  27. It is the definitive reference for all sorts of algorithms.  It's also
  28. highly enlightening just to read.  By Craig Finseth.  MIT PRess, *I think*,
  29. but I might be wrong.
  30.  
  31. In any case, the best general algorithm is the buffer gap.  That is,
  32. you have a buffer of a given size, with all the text smashed up against
  33. the beginning and end of the buffer, with a gap where the cursor is.
  34. (Actually, don't move the gap until you type a character.)
  35.  
  36. If the gap "fills in" and becomes zero size, you can either make the
  37. buffer larger, or go to a paged buffer gap, where you keep a list of
  38. fixed-size pages, and split and merge when they become empty and full.
  39.  
  40. But get Finseth's book.  It addresses *all sorts* of issues in text editor
  41. design.
  42. -- 
  43.     -Colin
  44.